I used the solution of below question for open file on Android.
Qt/Necessitas - reasonable QFileDialog replacement/skin?
But it works just on android,this codes (Qt Android Extras C++ Classes) don't run on windows?
for example i got the below errors?
#include<QAndroidJniObject>
#include<QtAndroid>
#include<QAndroidActivityResultReceiver>
Cannot open include file: 'QAndroidJniObject': No such file or directory
I used this for solving
#if defined(Q_OS_ANDROID)
#include<QAndroidJniObject>
#include<QtAndroid>
#include<QAndroidActivityResultReceiver>
#endif
but when i used this I have got another errors?
class ResultReceiver:public QAndroidActivityResultReceiver//error :'QAndroidActivityResultReceiver': base class undefined
{
AndroidFileDialog *_dialog;
public:
ResultReceiver(AndroidFileDialog *dialog);
virtual ~ResultReceiver();
void handleActivityResult(int receiverRequestCode, int resultCode, const QAndroidJniObject &data);
QString uriToPath(QAndroidJniObject uri);
};
'QAndroidActivityResultReceiver': base class undefined
Mohammad Kanan :
The class ResultReceiver inherits QAndroidActivityResultReceiver (from Android Extras) which you correctly stopped including for windows OS, thus the error. \nYou must have 2 variants of ResultReceiver class, one for Windows, another for Android. When you design it for Windows you should not inherit QAndroidActivityResultReceiver and use QFileDialog. \nIn the same way you solved the import issues with Qt pre-processor, you could define ResultReceiver class , for example:\n\n#if defined(Q_OS_ANDROID)\n\nclass AndroidFileDialog : public QObject\n{\n Q_OBJECT\n ...\nprivate:\n class ResultReceiver : public QAndroidActivityResultReceiver {\n AndroidFileDialog *_dialog;\n ...\n };\n ...\n ...\n};\n#else\nclass ResultReceiver // Here do not inherit classes from Android Extras\n{\n QFileDialog *_dialog; // use standard Qt C++ classes \n ...\n ...\n};\n#endif //Q_OS_ANDROID\n",
2018-07-18T15:20:07